package com.example.controller;

import com.example.entity.MaintenancePlan;
import com.example.service.MaintenancePlanService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("api/maintenance")
public class MaintenancePlanController {

    @Autowired
    private MaintenancePlanService maintenancePlanService;

    @ApiOperation(value = "查询列表的信息",notes = "获取列表信息")
    @RequestMapping(value="/queryList",method = RequestMethod.POST)
    Map<String,Object> queryList(@RequestBody MaintenancePlan maintenancePlan) {

        return maintenancePlanService.queryList(maintenancePlan);
    }

    @ApiOperation(value = "删除",notes = "删除")
    @RequestMapping(value="/deleteById/{id}",method = RequestMethod.POST)
    Map<String,Object> deleteById(@PathVariable(value = "id") String id) {

        return maintenancePlanService.deleteById(id);
    }

    @RequestMapping(value="/findById/{id}",method = RequestMethod.POST)
    Map<String,Object> findById(@PathVariable(value = "id") String id) {

        return maintenancePlanService.queryById(id);
    }


    @RequestMapping(value="/add",method = RequestMethod.POST)
    Map<String,Object> add(@RequestBody MaintenancePlan maintenancePlan) {

        return maintenancePlanService.insert(maintenancePlan);
    }
}
